const
        RES : array[1..3] of string = ('INSERT', 'DELETE', 'REPLACE');

var
        op : array[0..1000010, 1..2] of longint;
        ch : array[0..1000010] of char;
        s, t : string;

function make(s, t : string) : longint; // returns number of operations

const
        VR = 1;
        VI = 1;
        VD = 1;

var
        i, j, ls, lt, cur, ii, jj : longint;
        d : array[-10..1010, -10..1010] of longint;

begin
        ls := length(s);
        lt := length(t);
        fillchar(d, sizeof(d), 0);
        for i := 0 to ls do
                for j := 0 to lt do
                        if (i = 0) or (j = 0) then d[i][j] := max(i, j) else d[i][j] := min(d[i - 1][j] + VD, min(d[i][j - 1] + VI, d[i - 1][j - 1] + VR * byte(s[i] <> t[j])));
        result := d[ls][lt];
        i := ls;
        j := lt;
        cur := 1;
        while (i > 0) and (j > 0) do begin
                if (d[i][j] = d[i - 1][j - 1]) and (s[i] = t[j]) then begin
                        dec(i);
                        dec(j);
                        continue;
                end;
                if d[i][j] = d[i - 1][j - 1] + VR then begin
                        op[cur][1] := 3;
                        op[cur][2] := i;
                        ch[cur] := t[j];
                        dec(i);
                        dec(j);
                        inc(cur);
                        continue;
                end;
                if d[i][j] = d[i - 1][j] + VD then begin
                        op[cur][1] := 2;
                        op[cur][2] := i;
                        dec(i);
                        inc(cur);
                        continue;
                end;
                op[cur][1] := 1;
                op[cur][2] := i + 1;
                ch[cur] := t[j];
                dec(j);
                inc(cur);
        end;
        for ii := 1 to i do begin
                op[cur][1] := 2;
                op[cur][2] := 1;
                inc(cur);
        end;
        for jj := j downto 1 do begin
                op[cur][1] := 1;
                op[cur][2] := 1;
                ch[cur] := t[jj];
                inc(cur);
        end;
end;